<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增中介奖惩记录')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content" >
        <form class="form-horizontal m" id="form-evaluate-add">
            <input id="userId" name="userId"  type="hidden"  />
            <input id="rating" name="rating"  type="hidden"  />
            <div class="form-group">
                <label class="col-sm-3 control-label">用户：</label>
                <div class="col-sm-8">
                    <input id="userName" name="userName" class="form-control" type="text" th:onclick="selectUser()">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">奖惩积分：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('evaluate_type')}">
                        <input type="radio" th:id="${'name_' + dict.dictCode}" name="name" th:value="${dict.dictValue}" th:checked="${dict.default}" required>
                        <label th:for="${'name_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">积分：</label>
                <div class="col-sm-8">
                    <input name="bonus" class="form-control" type="text" required>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control"></textarea>
                </div>
            </div>



            <div class="row">
                <div class="col-sm-offset-5 col-sm-10">
                    <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
                    <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/evaluate"
        $("#form-evaluate-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
               // $.operate.save(prefix + "/add", $('#form-evaluate-add').serialize());
                var data = $("#form-evaluate-add").serializeArray();
                var status = $("input[id='status']").is(':checked') == true ? 0 : 1;
                data.push({"name": "status", "value": status});

                $.operate.saveTab(prefix + "/add", data);

            }
        }

        function selectUser() {
            var url = prefix + "/selectMyUser" ;
            $.modal.open("选择用户", url);
        }


    </script>
</body>
</html>